﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace NJL.WebUsers.Controls
{
    public partial class WUCELPS : BaseUserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if ("" != WEBSITE_FOCUS_CITY_CODE)
            {
                #region 吃
                NJL.BLL.NJL_COMPANY_SERVICE bllService = new BLL.NJL_COMPANY_SERVICE();
                DataSet ds = bllService.GetList(1, " TYPE_CODE='1' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND AREA_CODE='" + WEBSITE_FOCUS_CITY_CODE + "') ", "SORT DESC,CREATE_DATE_TIME desc");
                rptImageEat.DataSource = ds;
                rptImageEat.DataBind();

                ds = bllService.GetList(5, "TYPE_CODE='1' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND AREA_CODE='" + WEBSITE_FOCUS_CITY_CODE + "') and ID not in(select top 1 ID from NJL_COMPANY_SERVICE where TYPE_CODE='1' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND AREA_CODE='" + WEBSITE_FOCUS_CITY_CODE + "') order by SORT DESC,CREATE_DATE_TIME desc) ", "SORT DESC,CREATE_DATE_TIME desc");
                rptEat.DataSource = ds;
                rptEat.DataBind();
                #endregion
                #region 住
                ds = bllService.GetList(1, " TYPE_CODE='2' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND AREA_CODE='" + WEBSITE_FOCUS_CITY_CODE + "') ", "SORT DESC,CREATE_DATE_TIME desc");
                rptImageHouse.DataSource = ds;
                rptImageHouse.DataBind();

                ds = bllService.GetList(5, " TYPE_CODE='2' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND AREA_CODE='" + WEBSITE_FOCUS_CITY_CODE + "') and ID not in(select top 1 ID from NJL_COMPANY_SERVICE where TYPE_CODE='2' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND AREA_CODE='" + WEBSITE_FOCUS_CITY_CODE + "') order by SORT DESC,CREATE_DATE_TIME desc) ", "SORT DESC,CREATE_DATE_TIME desc");
                rptHouse.DataSource = ds;
                rptHouse.DataBind();
                #endregion
                #region 玩
                ds = bllService.GetList(1, " TYPE_CODE<>'1' and TYPE_CODE<>'2' and TYPE_CODE<>'20' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND AREA_CODE='" + WEBSITE_FOCUS_CITY_CODE + "') ", "SORT DESC,CREATE_DATE_TIME desc");
                rptImageLive.DataSource = ds;
                rptImageLive.DataBind();

                ds = bllService.GetList(5, " TYPE_CODE<>'1' and TYPE_CODE<>'2' and TYPE_CODE<>'20' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND AREA_CODE='" + WEBSITE_FOCUS_CITY_CODE + "') and ID not in(select top 1 ID from NJL_COMPANY_SERVICE where TYPE_CODE<>'1' and TYPE_CODE<>'2' and TYPE_CODE<>'20' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND AREA_CODE='" + WEBSITE_FOCUS_CITY_CODE + "') order by SORT DESC,CREATE_DATE_TIME desc) ", "SORT DESC,CREATE_DATE_TIME desc");
                rptLive.DataSource = ds;
                rptLive.DataBind();
                #endregion
                #region 购
                ds = bllService.GetList(1, " TYPE_CODE='20' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND AREA_CODE='" + WEBSITE_FOCUS_CITY_CODE + "') ", "SORT DESC,CREATE_DATE_TIME desc");
                rptImageShop.DataSource = ds;
                rptImageShop.DataBind();

                ds = bllService.GetList(5, " TYPE_CODE='20' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND AREA_CODE='" + WEBSITE_FOCUS_CITY_CODE + "') and ID not in(select top 1 ID from NJL_COMPANY_SERVICE where TYPE_CODE='20' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND AREA_CODE='" + WEBSITE_FOCUS_CITY_CODE + "') order by SORT DESC,CREATE_DATE_TIME desc)", "SORT DESC,CREATE_DATE_TIME desc");
                rptShop.DataSource = ds;
                rptShop.DataBind();
                #endregion
            }
            else
            {
                #region 吃
                NJL.BLL.NJL_COMPANY_SERVICE bllService = new BLL.NJL_COMPANY_SERVICE();
                DataSet ds = bllService.GetList(1, " TYPE_CODE='1' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND NJL_SYS_BASE_ID='" + WEBSITE_CODE + "') ", "SORT DESC,CREATE_DATE_TIME desc");
                rptImageEat.DataSource = ds;
                rptImageEat.DataBind();

                ds = bllService.GetList(5, "TYPE_CODE='1' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND NJL_SYS_BASE_ID='" + WEBSITE_CODE + "') and ID not in(select top 1 ID from NJL_COMPANY_SERVICE where TYPE_CODE='1' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where NJL_SYS_BASE_ID='" + WEBSITE_CODE + "') order by SORT DESC,CREATE_DATE_TIME desc) ", "SORT DESC,CREATE_DATE_TIME desc");
                rptEat.DataSource = ds;
                rptEat.DataBind();
                #endregion
                #region 住
                ds = bllService.GetList(1, " TYPE_CODE='2' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND NJL_SYS_BASE_ID='" + WEBSITE_CODE + "') ", "SORT DESC,CREATE_DATE_TIME desc");
                rptImageHouse.DataSource = ds;
                rptImageHouse.DataBind();

                ds = bllService.GetList(5, " TYPE_CODE='2' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND NJL_SYS_BASE_ID='" + WEBSITE_CODE + "') and ID not in(select top 1 ID from NJL_COMPANY_SERVICE where TYPE_CODE='2' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where NJL_SYS_BASE_ID='" + WEBSITE_CODE + "') order by SORT DESC,CREATE_DATE_TIME desc) ", "SORT DESC,CREATE_DATE_TIME desc");
                rptHouse.DataSource = ds;
                rptHouse.DataBind();
                #endregion
                #region 玩
                ds = bllService.GetList(1, " TYPE_CODE<>'1' and TYPE_CODE<>'2' and TYPE_CODE<>'20' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND NJL_SYS_BASE_ID='" + WEBSITE_CODE + "') ", "SORT DESC,CREATE_DATE_TIME desc");
                rptImageLive.DataSource = ds;
                rptImageLive.DataBind();

                ds = bllService.GetList(5, " TYPE_CODE<>'1' and TYPE_CODE<>'2' and TYPE_CODE<>'20' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND NJL_SYS_BASE_ID='" + WEBSITE_CODE + "') and ID not in(select top 1 ID from NJL_COMPANY_SERVICE where TYPE_CODE<>'1' and TYPE_CODE<>'2' and TYPE_CODE<>'20' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where NJL_SYS_BASE_ID='" + WEBSITE_CODE + "') order by SORT DESC,CREATE_DATE_TIME desc) ", "SORT DESC,CREATE_DATE_TIME desc");
                rptLive.DataSource = ds;
                rptLive.DataBind();
                #endregion
                #region 购
                ds = bllService.GetList(1, " TYPE_CODE='20' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND NJL_SYS_BASE_ID='" + WEBSITE_CODE + "') ", "SORT DESC,CREATE_DATE_TIME desc");
                rptImageShop.DataSource = ds;
                rptImageShop.DataBind();

                ds = bllService.GetList(5, " TYPE_CODE='20' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where AUDIT_STATE=1 AND NJL_SYS_BASE_ID='" + WEBSITE_CODE + "') and ID not in(select top 1 ID from NJL_COMPANY_SERVICE where TYPE_CODE='20' AND NJL_COMPANY_ID IN(select ID From NJL_COMPANY where NJL_SYS_BASE_ID='" + WEBSITE_CODE + "') order by SORT DESC,CREATE_DATE_TIME desc)", "SORT DESC,CREATE_DATE_TIME desc");
                rptShop.DataSource = ds;
                rptShop.DataBind();
                #endregion
            }
        }
    }
}